package com.aggregate.pay.sanstar;

import javax.servlet.http.HttpServletRequest;

import com.aggregate.pay.sanstar.bean.PayNotifyData;
import com.aggregate.pay.sanstar.bean.PayOrderData;
import com.aggregate.pay.sanstar.bean.PayOrderResult;
import com.aggregate.pay.sanstar.bean.PayQueryData;
import com.aggregate.pay.sanstar.bean.PayQueryResult;
import com.aggregate.pay.sanstar.bean.QrcodeAccountActiveData;
import com.aggregate.pay.sanstar.bean.QrcodeAddData;
import com.aggregate.pay.sanstar.bean.QrcodeNotifyData;
import com.aggregate.pay.sanstar.support.Client;
import com.aggregate.pay.sanstar.support.Config;
import com.aggregate.pay.sanstar.support.Factory;
import com.aggregate.pay.sanstar.support.HttpClient;
import com.aggregate.pay.sanstar.support.Merch;
import com.aggregate.pay.sanstar.support.client.PayNotify;
import com.aggregate.pay.sanstar.support.client.PayOrder;
import com.aggregate.pay.sanstar.support.client.PayQuery;
import com.aggregate.pay.sanstar.support.client.QrcodeAccountActive;
import com.aggregate.pay.sanstar.support.client.QrcodeAdd;
import com.aggregate.pay.sanstar.support.client.QrcodeNotify;

/**
 * 盛思达支付接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2017年9月29日
 */
public abstract class SanstarApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}

	@SuppressWarnings("unchecked")
	public static Client<PayOrderData, PayOrderResult> payOrderClient(Merch merch) {
		return (Client<PayOrderData, PayOrderResult>)Factory.getClient(PayOrder.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<PayQueryData, PayQueryResult> payQueryClient(Merch merch) {
		return (Client<PayQueryData, PayQueryResult>)Factory.getClient(PayQuery.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<HttpServletRequest, PayNotifyData> payNotifyClient(Merch merch) {
		return (Client<HttpServletRequest, PayNotifyData>)Factory.getClient(PayNotify.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<QrcodeAccountActiveData, Void> qrcodeAccountActiveClient(Merch merch) {
		return (Client<QrcodeAccountActiveData, Void>)Factory.getClient(QrcodeAccountActive.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<QrcodeAddData, Void> qrcodeAddClient(Merch merch) {
		return (Client<QrcodeAddData, Void>)Factory.getClient(QrcodeAdd.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<QrcodeNotifyData, Void> qrcodeNotifyClient(Merch merch) {
		return (Client<QrcodeNotifyData, Void>)Factory.getClient(QrcodeNotify.class, merch);
	}
	
}
